import { defHttp } from '/@/utils/http/axios';
import {
  IPostWarehouseListRequest,
  IPostWarehouseListResponse,
} from '/@/types/system/basic/warehouse/list';
import { IPostRawWarehouseDetailsResponse } from '/@/types/system/basic/warehouse/details';
import { IPostWarehouseDeleteRequest } from '/@/types/system/basic/warehouse/delete';
import { IPostWarehouseAddRequest } from '/@/types/system/basic/warehouse/add';
import { IPostWarehouseCheckNumberIsUniqueRequest } from '/@/types/system/basic/warehouse/checkNumberIsUnique';
import { IPostWarehouseUpdateRaw } from '/@/types/system/basic/warehouse/update';

/**
 * 仓库列表
 */
export const apiPostWarehouseList = (params: IPostWarehouseListRequest) =>
  defHttp.post<IPostWarehouseListResponse>({ url: `/system/basic/warehouse/list`, params });
/**
 * 仓库详情
 */
export const apiPostWarehouseDetailsPath = (id: string | number) =>
  defHttp.post<IPostRawWarehouseDetailsResponse>({ url: `/system/basic/warehouse/details/${id}` });
/**
 * 删除仓库
 */
export const apiPostWarehouseDelete = (params: IPostWarehouseDeleteRequest) =>
  defHttp.post({ url: `/system/basic/warehouse/delete`, params });
/**
 * 新增仓库
 */
export const apiPostWarehouseAdd = (params: IPostWarehouseAddRequest) =>
  defHttp.post({ url: `/system/basic/warehouse/add`, params });
/**
 * 校验仓库编号是否唯一
 */
export const apiPostWarehouseCheckNumberIsUnique = (
  params: IPostWarehouseCheckNumberIsUniqueRequest,
) => defHttp.post({ url: `/system/basic/warehouse/checkNumberIsUnique`, params });
/**
 * 编辑仓库
 */
export const apiPostWarehouseUpdatePath = (id: string | number, params: IPostWarehouseUpdateRaw) =>
  defHttp.post({ url: `/system/basic/warehouse/update/${id}`, params });
